You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below is a summary of compliance checks for this PR:
Security Compliance
⚪
Resource exhaustion risk
Description: On subscription error or timeout, the code sets a generic error message but does not attempt cleanup or throttling, which could allow repeated subscribe/unsubscribe cycles elsewhere to cause resource exhaustion; consider ensuring single subscription and guarding against duplicate channels. SharedShowModePage.tsx [116-124]
Referred Code
.subscribe((status,err)=>{if(status==="SUBSCRIBED"){console.log("Subscribed to real-time updates for Run of Show ID:",sharedData.id);}if(status==="CHANNEL_ERROR"||status==="TIMED_OUT"){console.error("Real-time subscription error:",status,err);setError("Connection lost. Please refresh to see live updates.");}});
Ticket Compliance
⚪
🎫 No ticket provided
Create ticket/issue
Codebase Duplication Compliance
⚪
Codebase context is not defined
Follow the guide to enable codebase context checks.
Custom Compliance
⚪
No custom compliance provided
Follow the guide to enable custom compliance check.
Compliance status legend
🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label
Change the useEffect dependency from sharedData to sharedData?.id to prevent an infinite loop of unsubscribing and re-subscribing to real-time updates.
useEffect(() => {
if (!sharedData || !sharedData.id) return;
const channel = supabase
.channel(`public:run_of_shows:id=eq.${sharedData.id}`)
.on(
"postgres_changes",
{
event: "UPDATE",
schema: "public",
table: "run_of_shows",
filter: `id=eq.${sharedData.id}`,
},
(payload) => {
console.log("Real-time update received:", payload);
const updatedRunOfShow = payload.new as SharedRunOfShowData;
setSharedData((prevData) => {
if (!prevData) return null;
return {
...prevData,
live_show_data: updatedRunOfShow.live_show_data,
items: updatedRunOfShow.items || prevData.items,
last_edited: updatedRunOfShow.last_edited || prevData.last_edited,
};
});
},
)
.subscribe((status, err) => {
if (status === "SUBSCRIBED") {
console.log("Subscribed to real-time updates for Run of Show ID:", sharedData.id);
}
if (status === "CHANNEL_ERROR" || status === "TIMED_OUT") {
console.error("Real-time subscription error:", status, err);
setError("Connection lost. Please refresh to see live updates.");
}
});
return () => {
supabase.removeChannel(channel);
};
-}, [sharedData]);+}, [sharedData?.id]);
[To ensure code accuracy, apply this suggestion manually]
Suggestion importance[1-10]: 9
__
Why: The suggestion correctly identifies a critical bug that creates an infinite loop of subscriptions and unsubscriptions, and the proposed fix of changing the dependency array is the correct solution.
High
More
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
…wer"
This reverts commit 977c101.
PR Type
Other
Description
Reverts automatic WebSocket reconnection feature for Run of Show viewer
Removes complex realtime subscription hook with retry logic
Simplifies connection status UI to basic legend only
Returns to basic Supabase realtime subscription implementation
Diagram Walkthrough
File Walkthrough
useRealtimeSubscription.ts
Remove entire realtime subscription hook fileapps/web/src/hooks/useRealtimeSubscription.ts
subscription hook
logic
SharedShowModePage.tsx
Revert to basic Supabase realtime subscriptionapps/web/src/pages/SharedShowModePage.tsx
useRealtimeSubscriptionhook and related icons